class MyParagraph extends HTMLElement {
  constructor() {
    super();
    this.counter=0;
    const template = document.getElementById("para_tmpl");
    const templateContent = template.content;

    var shadowroot = this.attachShadow({ mode: "open" });
    shadowroot.appendChild(templateContent.cloneNode(true));
    
    shadowroot.querySelectorAll("slot").forEach(slot=>{
      slot.addEventListener("slotchange",function(ev){
        console.log("监测到slotChange:  slot=",this,"插入元素是：",this.assignedNodes(),"  event=",ev)
      })
    })
  }

  
}
customElements.define("my-paragraph", MyParagraph)